﻿using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL
{
    public class MemberTypeDAL
    {

        public DataTable SelectMemberType()
        {
            string sql = "select * from MemberType";
            
            return SQLiteHelper.ExecuteFill(sql);
        }

        public int InsertMemberInfo(MemberInfo memberInfo)
        {
            string sql = "INSERT INTO MemberInfo (mname, gender, type, discount, money, points, birthday, phoneNum, registDate, endDate )" +
                "VALUES (@mname, @gender, @type, @discount, @money, @points, @birthday, @phoneNum, @registDate, @endDate);";

            SQLiteParameter[] sQLiteParameters = new SQLiteParameter[]
            {
                new SQLiteParameter("@mname", memberInfo.Mname),
                new SQLiteParameter("@gender", memberInfo.Gender),
                new SQLiteParameter("@type", memberInfo.Type),
                new SQLiteParameter("@discount", memberInfo.Discount),
                new SQLiteParameter("@money", memberInfo.Money),
                new SQLiteParameter("@points", memberInfo.Points),
                new SQLiteParameter("@birthday", memberInfo.Birthday),
                new SQLiteParameter("@phoneNum", memberInfo.PhoneNum),
                new SQLiteParameter("@registDate", memberInfo.RegistDate),
                new SQLiteParameter("@endDate", memberInfo.EndDate)

            };
            return SQLiteHelper.ExecuteNonQuery(sql,sQLiteParameters);
        }
    }
}
